package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.cnswhy.cloud.server.common.entity.enumeration.BusType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2021-02-24
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_split_trans_record")
@ApiModel(value = "SplitTransRecord", description = "")
@AllArgsConstructor
public class SplitTransRecord extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 业务类型
     */
    @ApiModelProperty(value = "业务类型")
    @NotEmpty(message = "业务类型不能为空")
    @Length(max = 32, message = "业务类型长度不能超过32")
    @TableField(value = "bus_type", condition = LIKE)
    @Excel(name = "业务类型", replace = {"无卡_CPS_NO_CARD", "物联充电线_IOT_CHARG_LINE"})
    private BusType busType;

    /**
     * 分成级别
     */
    @ApiModelProperty(value = "分成级别")
    @TableField("split_level")
    @Excel(name = "")
    private Integer splitLevel;

    /**
     * 成本手续费
     */
    @ApiModelProperty(value = "成本手续费")
    @TableField("extern_fee")
    @Excel(name = "")
    private Long externFee;

    /**
     * 成本费率
     */
    @ApiModelProperty(value = "成本费率")
    @TableField("fee_rate")
    @Excel(name = "")
    private Long feeRate;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @Length(max = 32, message = "订单号长度不能超过32")
    @TableField(value = "order_id", condition = LIKE)
    @Excel(name = "订单号")
    private String orderId;

    /**
     * 交易费率
     */
    @ApiModelProperty(value = "交易费率")
    @TableField("trans_fee_rate")
    @Excel(name = "交易费率")
    private Long transFeeRate;

    /**
     * 交易附加手续费
     */
    @ApiModelProperty(value = "交易附加手续费")
    @TableField("trans_extern_fee")
    @Excel(name = "交易附加手续费")
    private Long transExternFee;

    /**
     * 交易客户
     */
    @ApiModelProperty(value = "交易客户")
    @TableField("customer_id")
    @Excel(name = "交易客户")
    private Long customerId;

    /**
     * 分成客户
     */
    @ApiModelProperty(value = "分成客户")
    @TableField("split_customer_id")
    @Excel(name = "分成客户")
    private Long splitCustomerId;

    /**
     * 手续费分成
     */
    @ApiModelProperty(value = "手续费分成")
    @TableField("split_fee")
    @Excel(name = "")
    private Long splitFee;

    /**
     * 附加手续费分成
     */
    @ApiModelProperty(value = "附加手续费分成")
    @TableField("split_extern_fee")
    @Excel(name = "")
    private Long splitExternFee;

    /**
     * 总分成
     */
    @ApiModelProperty(value = "总分成")
    @TableField("split_amt")
    @Excel(name = "总分成")
    private Long splitAmt;

    /**
     * 交易金额
     */
    @ApiModelProperty(value = "交易金额")
    @TableField("trans_amt")
    @Excel(name = "交易金额")
    private Long transAmt;

    /**
     * 入账标志
     */
    @ApiModelProperty(value = "入账标志")
    @TableField("account_flag")
    @Excel(name = "")
    private Integer accountFlag;

    /**
     * 登录账号
     */
    @ApiModelProperty(value = "登录账号")
    @Length(max = 255, message = "登录账号长度不能超过255")
    @TableField(value = "mobile", condition = LIKE)
    @Excel(name = "登录账号")
    private String mobile;

    /**
     * 清算日期
     */
    @ApiModelProperty(value = "清算日期")
    @Length(max = 8, message = "清算日期长度不能超过8")
    @TableField(value = "sett_date", condition = LIKE)
    @Excel(name = "清算日期")
    private String settDate;

    /**
     * 分账账号
     */
    @ApiModelProperty(value = "分账账号")
    @Length(max = 255, message = "分账账号长度不能超过255")
    @TableField(value = "promoter_mobile", condition = LIKE)
    @Excel(name = "分账账号")
    private String promoterMobile;

    /**
     * 交易客户
     */
    @ApiModelProperty(value = "交易客户")
    @Length(max = 255, message = "交易客户长度不能超过255")
    @TableField(value = "cust_name", condition = LIKE)
    @Excel(name = "交易客户")
    private String custName;

    /**
     * 分账客户
     */
    @ApiModelProperty(value = "分账客户")
    @Length(max = 255, message = "分账客户长度不能超过255")
    @TableField(value = "promoter_name", condition = LIKE)
    @Excel(name = "分账客户")
    private String promoterName;


    @Builder
    public SplitTransRecord(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long updateUser, Long createUser,
                            BusType busType, Integer splitLevel, Long externFee, Long feeRate, String orderId,
                    Long transFeeRate, Long transExternFee, Long customerId, Long splitCustomerId, Long splitFee, Long splitExternFee, 
                    Long splitAmt, Long transAmt, Integer accountFlag, String mobile, String settDate, String promoterMobile, 
                    String custName, String promoterName) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createUser = createUser;
        this.busType = busType;
        this.splitLevel = splitLevel;
        this.externFee = externFee;
        this.feeRate = feeRate;
        this.orderId = orderId;
        this.transFeeRate = transFeeRate;
        this.transExternFee = transExternFee;
        this.customerId = customerId;
        this.splitCustomerId = splitCustomerId;
        this.splitFee = splitFee;
        this.splitExternFee = splitExternFee;
        this.splitAmt = splitAmt;
        this.transAmt = transAmt;
        this.accountFlag = accountFlag;
        this.mobile = mobile;
        this.settDate = settDate;
        this.promoterMobile = promoterMobile;
        this.custName = custName;
        this.promoterName = promoterName;
    }

}
